package server

import "time"

type ClientWriteIdleTimeout struct {
	client *Client
}

func (x *ClientWriteIdleTimeout) OnTimeout() {
	x.client.onWriteIdleTimeout()
}

func (x *ClientWriteIdleTimeout) IsTimeout() bool {
	return x.client.lastWriteAt.Add(x.client.writeIdleTimeout).Before(time.Now())
}

func NewClientWriteIdleTimeout(client *Client) *ClientWriteIdleTimeout {
	return &ClientWriteIdleTimeout{client: client}
}
